﻿@using cmdb.keede.common
@{
    ViewData["Title"] = "Index";
    Layout = "~/Views/Shared/_rootLayout.cshtml";
}
@await Html.PartialAsync("_pagingLayout")

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-body" style="margin-left: 10px; margin-right: 10px;" id="search-from">
                <form>
                <div class="row" style="margin-bottom: 10px">
                    <div class="col-md-3">
                        <div class="input-group">
                            <span class="input-group-addon">固定资产编号</span>
                            <input type="text" class="form-control" id="s_AssetId" aria-describedby="basic-addon1">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="input-group">
                            <span class="input-group-addon">区域</span>
                            <input type="text" class="form-control" id="s_Area" aria-describedby="basic-addon1">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="input-group">
                            <span class="input-group-addon">设备类型</span>
                            <input type="text" class="form-control" id="s_DeviceType" aria-describedby="basic-addon1">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="input-group">
                            <span class="input-group-addon">操作系统</span>
                            @Html.DropDownList("s_OS", Html.GetEnumSelectList<EnumOperationSystem>(), "——Select——", new {@class = "form-control"})
                        </div>
                    </div>
                </div>
                <div class="row" style="margin-bottom: 10px">
                    <div class="col-md-3">
                        <div class="input-group">
                            <span class="input-group-addon">内网IP</span>
                            <input type="text" class="form-control" id="s_InnerIP" aria-describedby="basic-addon1">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="input-group">
                            <span class="input-group-addon">外网IP</span>
                            <input type="text" class="form-control" id="s_OuterIP" aria-describedby="basic-addon1">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="input-group">
                            <span class="input-group-addon">硬盘容量(GB)</span>
                            <input type="text" class="form-control" id="s_HardDiskSize" aria-describedby="basic-addon1">
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="input-group">
                            <span class="input-group-addon">内存容量(GB)</span>
                            <input type="text" class="form-control" id="s_RAM" aria-describedby="basic-addon1">
                        </div>
                    </div>
                </div>
                    <div class="row" style="margin-bottom: 10px">
                        <div class="col-md-3">
                            <div class="input-group">
                                <span class="input-group-addon">CPU</span>
                                <input type="text" class="form-control" id="s_CPU" aria-describedby="basic-addon1">
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="input-group">
                                <span class="input-group-addon">机器状态</span>
                                @Html.DropDownList("s_Status", Html.GetEnumSelectList<EnumVirtualHostStatus>(), "——Select——", new {@class = "form-control"})
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="input-group">
                                <span class="input-group-addon">到期时间</span>
                                <input type="text" readonly class="Wdate35 form-control" id="s_ExpireTimeStart" placeholder="请选择到期起始时间..." onclick="WdatePicker({ isShowWeek: true })">
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="input-group">
                                <span class="input-group-addon">-</span>
                                <input type="text" readonly class="Wdate35 form-control" id="s_ExpireTimeEnd" placeholder="请选择到期截止时间..." onclick="WdatePicker({ isShowWeek: true })">
                            </div>
                        </div>
                    </div>
                    <div class=" col-xs-12 text-center">
                        <input type="reset" class=" btn btn-default" value="重置" />
                        <input type="button" id="search-submit" class=" btn btn-google" value="查询" />
                    </div>
                </form>
            </div>
            <div class="box-body div-table-content">
                <div class="box-body" style="overflow-x: auto;">
                    <table id="table" class="table table-bordered table-hover">
                        <thead id="thead">
                            <tr>
                                <th style="width: 160px;">@Html.Label("内网IP")</th>
                                <th style="width: 160px;">@Html.Label("外网IP")</th>
                                <th style="width: 160px;">@Html.Label("操作系统")</th>
                                <th style="width: 160px;">@Html.Label("cpu")</th>
                                <th style="width: 160px;">@Html.Label("内存")</th>
                                <th style="width: 160px;">@Html.Label("硬盘")</th>
                                <th style="width: 160px;">@Html.Label("带宽")</th>
                                <th style="width: 160px;">@Html.Label("区域")</th>
                                <th style="width:160px;">@Html.Label("操作")</th>
                            </tr>
                        </thead>
                        <tbody id="tbody"></tbody>
                    </table>
                </div>
                <div class="pull-right">
                    <div id="nav"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/template" id="listTemplate">
    <% _.each(obj,function(item) {%>
    <tr>
        <td>
            <%=item.innerIP%>
        </td>
        <td>
            <%=item.outerIP%>
        </td>
        <td>
            <%=item.os%>
        </td>
        <td>
            <%=item.cpu%>
        </td>
        <td>
            <%=item.ram%>
        </td>
        <td>
            <%=item.hardDiskSize%>
        </td>
        <td>
            <%=item.networkBandwidth%>
        </td>
        <td>
            <%=item.area%>
        </td>
        <td>
            <span data-type="edit" data-id="<%=item.id%>" class="label label-success option-hover">编辑</span>&nbsp;<span data-type="detail" data-id="<%=item.id%>" class="label label-success option-hover">明细</span>
        </td>
    </tr>
    <% });%>
</script>

<div class="modal fade in" id="createModel" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title">编辑主机信息</h4>
            </div>
            <div class="modal-body">
                <div class="form-horizontal">
                    <div class="box-body">
                        <input id="Id" type="hidden" />
                        <div class="form-group">
                            <label class="col-sm-3 control-label">固定资产编号</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="txtAssetId" name="txtAssetId" placeholder="请输入固定资产编号...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">区域</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtArea" name="txtArea" class="form-control" placeholder="请输入区域...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">系统用户名</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtUserName" name="txtUserName" class="form-control" placeholder="请输入系统用户名...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">系统密码</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtPassword" name="txtPassword" class="form-control" placeholder="请输入系统密码...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">内网IP</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtInnerIP" name="txtInnerIP" class="form-control" placeholder="请输入内网IP...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">外网IP</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtOuterIP" name="txtOuterIP" class="form-control" placeholder="请输入外网IP...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">CPU内核数</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtCPU" name="txtCPU" class="form-control" placeholder="请输入CPU内核数...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">硬盘容量(GB)</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtHardDiskSize" name="txtHardDiskSize" class="form-control" placeholder="请输入硬盘容量(GB)...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">内存容量(GB)</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtRAM" name="txtRAM" class="form-control" placeholder="请输入内存容量(GB)...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">带宽(Mbps)</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtNetworkBandwidth" name="txtNetworkBandwidth" class="form-control" placeholder="请输入带宽(Mbps)...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">运维负责人</label>
                            <div class="col-sm-9">
                                <input type="text" id="txtMaintainers" name="txtMaintainers" class="form-control" placeholder="请输入运维负责人...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">到期时间</label>
                            <div class="col-sm-9">
                                <input type="text" readonly id="txtExpireTime" name="txtExpireTime" class="Wdate35 form-control" placeholder="请选择到期时间..." onclick="WdatePicker({isShowWeek:true})"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注</label>
                            <div class="col-sm-9">
                                <textarea id="txtRemark" name="txtRemark" class="form-control" placeholder="请输入备注..."></textarea>
                            </div>
                        </div>
                        <div class="col-xs-12" id="createErrorMsg" style="display: none;">
                            <div class="form-group has-error">
                                <label class="control-label" style=""><i class="fa fa-remove"></i><span style="padding-left:12px"></span></label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" id="btnSubmit">Save changes</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade in" id="detailModel" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title">主机明细</h4>
            </div>
            <div class="modal-body">
                <div class="form-horizontal">
                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">固定资产编号：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelAssetId"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">区域：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelArea"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">操作系统：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelOS"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">操作系统：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelOSVersion"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">系统用户名：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelUserName"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">系统密码：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelPassword"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">内网IP：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelInnerIP"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">外网IP：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelOuterIP"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">CPU内核数：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelCPU"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">硬盘容量(GB)：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelHardDiskSize"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">内存容量(GB)：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelRAM"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">带宽(Mbps)：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelNetworkBandwidth"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">运维负责人：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelMaintainers"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">创建时间：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelCreateTime"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">到期时间：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelExpireTime"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注：</label>
                            <div class="col-sm-9">
                                <label class="control-label" id="labelRemark"></label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<environment include="Development">
    <script src="~/lib/underscore/underscore.js"></script>
    <script src="~/js/VirtualHost/index.js"></script>
    <script src="~/lib/my97datepicker/My97DatePicker/WdatePicker.js"></script>
</environment>

<environment exclude="Development">
    <script src="~/lib/underscore/underscore-min.js"></script>
    <script src="~/js/VirtualHost/index.min.js"></script>
    <script src="~/lib/my97datepicker/My97DatePicker/WdatePicker.js"></script>
</environment>